use of org.jivesoftware.spark.component.VerticalFlowLayout in project Spark by igniterealtime.
the class TaskNotification method notifyUser.
private void notifyUser() {
TimerTask newTask = new TimerTask() {
@Override
public void run() {
EventQueue.invokeLater(() -> {
final JPanel mainPanel = new JPanel();
mainPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
mainPanel.setBackground(Color.white);
long now = System.currentTimeMillis();
Tasks tasks = Tasks.getTaskList(SparkManager.getConnection());
Iterator<Task> taskIter = tasks.getTasks().iterator();
final JPanel titlePanel = new JPanel(new BorderLayout()) {
private static final long serialVersionUID = -8871487137643685431L;
public void paintComponent(Graphics g) {
Color startColor = Color.white;
Color endColor = new Color(198, 211, 247);
Graphics2D g2 = (Graphics2D) g;
int w = getWidth();
int h = getHeight();
GradientPaint gradient = new GradientPaint(0, 0, startColor, w, h, endColor, true);
g2.setPaint(gradient);
g2.fillRect(0, 0, w, h);
}
};
final JLabel taskLabel = new JLabel("Due ");
taskLabel.setFont(taskLabel.getFont().deriveFont(Font.BOLD));
titlePanel.add(taskLabel, BorderLayout.EAST);
mainPanel.add(titlePanel);
boolean hasItems = false;
while (taskIter.hasNext()) {
Task task = taskIter.next();
if (task.isCompleted()) {
continue;
}
long dueDate = task.getDueDate();
if (dueDate != -1) {
if (now > dueDate) {
final JPanel item = new JPanel(new BorderLayout());
item.setOpaque(false);
JLabel label = new JLabel(task.getTitle());
item.add(label, BorderLayout.CENTER);
JLabel dueItem = new JLabel(formatter.format(new Date(task.getDueDate())));
item.add(dueItem, BorderLayout.EAST);
mainPanel.add(item);
hasItems = true;
}
}
}
if (hasItems) {
SparkToaster toaster = new SparkToaster();
toaster.setDisplayTime(30000);
toaster.setToasterHeight(175);
toaster.setToasterWidth(300);
toaster.setBorder(BorderFactory.createBevelBorder(0));
JScrollPane pane = new JScrollPane(mainPanel);
pane.getViewport().setBackground(Color.white);
toaster.showToaster(Res.getString("title.task.notification"), pane);
}
});
}
};
TaskEngine.getInstance().schedule(newTask, 500);
}
use of org.jivesoftware.spark.component.VerticalFlowLayout in project Spark by igniterealtime.
the class GroupChatPreferencePanel method createUI.
private void createUI() {
setLayout(new VerticalFlowLayout());
ResourceUtils.resButton(highlightMyName, Res.getString("menuitem.add.groupchat.myname"));
ResourceUtils.resButton(highlightMyText, Res.getString("menuitem.add.groupchat.mytext"));
ResourceUtils.resButton(highlightPopName, Res.getString("menuitem.add.groupchat.popname"));
ResourceUtils.resButton(showjoinleavemessage, Res.getString("menuitem.add.groupchat.showjoinleavemessage"));
ResourceUtils.resButton(showroleicons, Res.getString("menuitem.add.groupchat.showrolesinsteadofstatus"));
ResourceUtils.resButton(_autoAcceptInvites, Res.getString("menuitem.add.groupchat.auto.accept.invite"));
ResourceUtils.resButton(_randomcolors, Res.getString("menuitem.add.groupchat.random.colors"));
ResourceUtils.resButton(inviteToBookmark, Res.getString("menuitem.add.groupchat.invitetobookmark"));
gCPanel.setBorder(BorderFactory.createTitledBorder(Res.getString("title.group.chat.settings")));
add(gCPanel);
gCPanel.setLayout(new GridBagLayout());
gCPanel.add(highlightMyName, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(highlightMyText, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(_randomcolors, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(highlightPopName, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(showjoinleavemessage, new GridBagConstraints(0, 4, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(showroleicons, new GridBagConstraints(0, 5, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(_autoAcceptInvites, new GridBagConstraints(0, 6, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
gCPanel.add(inviteToBookmark, new GridBagConstraints(0, 7, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
use of org.jivesoftware.spark.component.VerticalFlowLayout in project Spark by igniterealtime.
the class RoarPreferencePanel method makeGeneralSettingsPanel.
private JComponent makeGeneralSettingsPanel() {
JPanel generalPanel = new JPanel();
generalPanel.setLayout(new GridBagLayout());
generalPanel.setBorder(BorderFactory.createTitledBorder(RoarResources.getString("roar.settings")));
int rowcount = 0;
generalPanel.add(_enabledCheckbox, new GridBagConstraints(0, rowcount, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
rowcount++;
generalPanel.add(new JLabel(RoarResources.getString("roar.amount")), new GridBagConstraints(0, rowcount, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
generalPanel.add(_amount, new GridBagConstraints(1, rowcount, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
rowcount++;
generalPanel.add(new JLabel(RoarResources.getString("roar.location")), new GridBagConstraints(0, rowcount, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
generalPanel.add(_typelist, new GridBagConstraints(1, rowcount, 1, 1, 0.8, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
rowcount++;
JLabel warningLabel = new JLabel("<html>placeholder :-)</html>");
// warningLabel.setForeground(Color.RED);
generalPanel.add(warningLabel, new GridBagConstraints(1, rowcount, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, INSETS, 0, 0));
_components.put("label.warning", warningLabel);
JPanel panel = new JPanel(new VerticalFlowLayout());
panel.add(generalPanel);
panel.add(makeSinglePanel());
panel.add(makeGroupChatPanel());
panel.add(makeKeyWordPanel());
JScrollPane scroll = new JScrollPane(panel);
return scroll;
}
use of org.jivesoftware.spark.component.VerticalFlowLayout in project Spark by igniterealtime.
the class SipPreferencePanel method createUI.
private void createUI() {
setLayout(new VerticalFlowLayout());
// Setup Mnemonics
ResourceUtils.resLabel(userNameLabel, userNameField, "&Username:");
ResourceUtils.resLabel(authUserNameLabel, authUserNameField, "&AuthUsername:");
ResourceUtils.resLabel(passwordLabel, passwordField, "&Password:");
ResourceUtils.resLabel(serverLabel, serverField, "&Server:");
ResourceUtils.resButton(registerCheckBox, "&Register in start");
ResourceUtils.resLabel(stunServerLabel, stunServerField, "&Stun Server:");
ResourceUtils.resLabel(stunPortLabel, stunPortField, "&Stun Port:");
ResourceUtils.resButton(useStun, "&Use stun");
generalPanel.setBorder(BorderFactory.createTitledBorder("General Information"));
add(generalPanel);
generalPanel.setLayout(new GridBagLayout());
generalPanel.add(userNameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
generalPanel.add(userNameField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
generalPanel.add(authUserNameLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
generalPanel.add(authUserNameField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
generalPanel.add(passwordLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
generalPanel.add(passwordField, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
generalPanel.add(serverLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
generalPanel.add(serverField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
generalPanel.add(registerCheckBox, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
// Network Panel
networkPanel.setBorder(BorderFactory.createTitledBorder("Network Information"));
add(networkPanel);
networkPanel.setLayout(new GridBagLayout());
networkPanel.add(stunServerLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
networkPanel.add(stunServerField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
networkPanel.add(stunPortLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
networkPanel.add(stunPortField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
networkPanel.add(useStun, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0));
}
Aggregations