Package org.jmule.ui.swt.skin

Examples of org.jmule.ui.swt.skin.SWTSkin


   
  }

  public void initUIComponents() {
    String title = Localizer._("serveraddwindow.title");
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
   
    Display display = SWTThread.getDisplay();
   
    final Shell shell1=new Shell(display,SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   
    shell.setImage(SWTImageRepository.getImage("server_add.png"));
    shell.setText(title);
   
    Utils.centreWindow(shell);
   
    shell.setLayout(new GridLayout(1,true));
   
    Composite content = new Composite(shell,SWT.BORDER);
    content.setLayoutData(new GridData(GridData.FILL_BOTH));
    content.setLayout(new GridLayout(2,false));
   
    Label label = new Label(content,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("serveraddwindow.server_ip_address")+" : ");
   
    final Text text_server_ip = new Text(content,SWT.BORDER);
    text_server_ip.setFont(skin.getDefaultFont());
    text_server_ip.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    text_server_ip.addListener(SWT.Verify,new Listener() {
      public void handleEvent(Event e) {
            String text = e.text;
            char[] chars = new char[text.length()];
            text.getChars(0, chars.length, chars, 0);
            for (int i = 0; i < chars.length; i++) {
              if (!('0' <= chars[i] && chars[i] <= '9'))
                if (chars[i]!='.') {
               
                  e.doit = false;
                  return;
              }
        }
      }
    });
   
    label = new Label(content,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("serveraddwindow.server_port")+" : ");
   
    final Text text_port = new Text(content,SWT.BORDER);
    text_port.setFont(skin.getDefaultFont());
    text_port.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    text_port.addListener(SWT.Verify,new Listener() {
      public void handleEvent(Event e) {
            String text = e.text;
            char[] chars = new char[text.length()];
            text.getChars(0, chars.length, chars, 0);
            for (int i = 0; i < chars.length; i++) {
              if (!('0' <= chars[i] && chars[i] <= '9')) {
                  e.doit = false;
                  return;
              }
        }
      }
    });
   
    Composite buttons_composite = new Composite(shell,SWT.NONE);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    buttons_composite.setLayout(new GridLayout(2,false));
   
    Button button_ok = new Button(buttons_composite,SWT.NONE);
    GridData grid_data = new GridData();
    //grid_data.widthHint = 40;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
    button_ok.setLayoutData(grid_data);
   
    button_ok.setFont(skin.getButtonFont());
    button_ok.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
    button_ok.setText(Localizer._("mainwindow.button.ok"));
    button_ok.addSelectionListener(new SelectionListener() {
    public void widgetDefaultSelected(SelectionEvent arg0) {
      }

      public void widgetSelected(SelectionEvent arg0) {
        String server_ip = text_server_ip.getText();
        if (!AddressUtils.isValidIP(server_ip)) {
          MessageBox dialog = new MessageBox(shell,
                      SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_address"));
          dialog.open();
          return ;
        }
       
        if (!AddressUtils.isValidPort(text_port.getText())) {
          MessageBox dialog = new MessageBox(shell,
          SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_port"));
          dialog.open();
          return ;
        }
        int server_port = Integer.parseInt(text_port.getText());
        try {
          _core.getServerManager().newServer(server_ip, server_port);
        } catch (ServerManagerException e) {
          Utils.showWarningMessage(shell, "", e.getMessage());
        }
       
        shell.close();
    } });
   
    Button button_cancel = new Button(buttons_composite,SWT.NONE);
    button_cancel.setImage(skin.getButtonImage(SkinConstants.CANCEL_BUTTON_IMAGE));
    button_cancel.setText(Localizer._("mainwindow.button.cancel"));
   
    button_cancel.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent arg0) {
View Full Code Here


 
  public ServerListTab(Composite shell,JMuleCore core) {
   
    super(shell);
 
    SWTSkin skin = null;
    try {
     
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
    }catch(Throwable t) {}
    FormLayout form = new FormLayout ();
    setLayout (form);
   
    server_table_panel = new Composite(this,SWT.NONE);
    server_table_panel.setLayout(new FillLayout());
   
    server_info_panel = new Composite(this,SWT.BORDER);
   
   
    SashControl.createHorizontalSash(20, 50, this, server_table_panel, server_info_panel);
   
    server_info_panel.setLayout(new FormLayout());
   
    Composite server_messages = new Composite(server_info_panel,SWT.NONE);
    server_messages.setLayout(new FillLayout());
   
    Composite peer_info = new Composite(server_info_panel,SWT.NONE);
    peer_info.setLayout(new FillLayout());
   
    SashControl.createVerticalSash(20, 70, server_info_panel, server_messages, peer_info);

    // Server List
    server_list_group = new Group(server_table_panel,SWT.NONE);
    server_list_group.setLayout(new FillLayout());
   
    setServerCount(core.getServerManager().getServersCount());
   
    server_list = new ServerList(server_list_group,core.getServerManager());
   
    //Server Messages
    new ServerMessages(server_messages);
   
    connection_info = new ConnectionInfo(peer_info,core);
   
    connection_info.setFont(skin.getDefaultFont());
   
    SWTServerListWrapper.getInstance().setServerListTab(this);
  }
View Full Code Here

   * @param _listener Callback listener to trigger when columns changed
   */
  public TableColumnEditorWindow(final Table editTable,Shell parent,
                   TableColumn[] _tableColumns,
                                 TableStructureModificationListener _listener) {
  SWTSkin skin = null;
  try {
   
    skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
   
  }catch(Throwable t) {
  }
   
    RowData rd;
    display = parent.getDisplay();
    listener = _listener;
   
    tableColumns = new ArrayList<TableColumn>();
    for(int i = 0;i<editTable.getColumnCount();i++){
      int id = editTable.getColumnOrder()[i];
      tableColumns.add(editTable.getColumn(id));
    }
   
    newEnabledState = new HashMap<TableColumn,Boolean>();

    for(TableColumn column : tableColumns) {
      int column_id = (Integer)column.getData(SWTConstants.COLUMN_NAME_KEY);
      Boolean status = SWTPreferences.getInstance().isColumnVisible(column_id);
      newEnabledState.put(column, status);
    }
   
   
    blue = new Color(display,0,0,128);
  
    Shell shell1=new Shell(display,SWT.ON_TOP);
  shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
  shell.setText(Localizer._("columneditorwindow.title"));
  shell.setImage(SWTImageRepository.getImage("columns_setup.png"));
 
    GridLayout layout = new GridLayout();
    shell.setLayout (layout);
   
    GridData gridData;
   
    Label label = new Label(shell,SWT.NULL);
    label.setText(Localizer._("columneditorwindow.draghint"));
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gridData);
   
    table = new Table (shell, SWT.VIRTUAL | SWT.CHECK | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    gridData = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
   
    Composite cButtonArea = new Composite(shell, SWT.NULL);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    cButtonArea.setLayoutData(gridData);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.marginLeft = 0;
   rLayout.marginTop = 0;
   rLayout.marginRight = 0;
   rLayout.marginBottom = 0;
   rLayout.spacing = 5;
   cButtonArea.setLayout (rLayout);
   
    Button bOk = new Button(cButtonArea,SWT.PUSH);
    bOk.setFont(skin.getButtonFont());
    bOk.setImage(skin.getButtonImage(SkinConstants.FINISH_BUTTON_IMAGE));
    bOk.setText(Localizer._("mainwindow.button.ok"));
    rd = new RowData();
    rd.width = 70;
    bOk.setLayoutData(rd);
    bOk.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        saveAndApply();
        close();
      }
    });
   
    Button bCancel = new Button(cButtonArea,SWT.PUSH);
    bCancel.setFont(skin.getButtonFont());
    bCancel.setImage(skin.getButtonImage(SkinConstants.CANCEL_BUTTON_IMAGE));
    bCancel.setText(Localizer._("mainwindow.button.cancel"));
    rd = new RowData();
    rd.width = 70;
    bCancel.setLayoutData(rd);
    bCancel.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        close();
      }
    });
   
    Button bApply = new Button(cButtonArea,SWT.PUSH);
    bApply.setFont(skin.getButtonFont());
    bApply.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
    bApply.setText(Localizer._("mainwindo.button.apply"));
    rd = new RowData();
    rd.width = 70;
    bApply.setLayoutData(rd);
    bApply.addListener(SWT.Selection,new Listener() {
View Full Code Here

 
  public void getCoreComponents() {
  }

  public void initUIComponents() {
    SWTSkin skin = null;
    try {
        skin = (SWTSkin)JMuleUIManager.getJMuleUI().getSkin();
    }catch(Throwable t) { }
   
    final Shell shell1=new Shell(SWTThread.getDisplay(),SWT.ON_TOP);
    shell=new Shell(shell1,SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   
    shell.setSize(400, 330);
    Utils.centreWindow(shell);
   
    shell.setImage(SWTImageRepository.getImage("updater.png"));
    shell.setText(_._("updaterwindow.title"));

    shell.setLayout(new GridLayout(1,false));
   
    Label label;
    GridData grid_data;
    GridLayout layout;
   
    Composite window_content = new Composite(shell,SWT.NONE);
    layout = new GridLayout(2,false);
    layout.marginLeft = 50;
    layout.marginBottom = 0;
    window_content.setLayout(layout);
    window_content.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    label = new Label(window_content,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(JMConstants.JMULE_NAME + " " + _._("updaterwindow.label.jmule_version") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    user_version = new Label(window_content,SWT.NONE);
    FontData data = skin.getDefaultFont().getFontData()[0];
    Font font = new Font(SWTThread.getDisplay(),data.getName(),data.getHeight(),SWT.BOLD );
    user_version.setFont(font);
    user_version.setText(JMConstants.CURRENT_JMULE_VERSION);
    user_version.setForeground(green_color);
   
    label = new Label(window_content,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setText(_._("updaterwindow.label.available_version") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    available_version = new Label(window_content,SWT.NONE);
    available_version.setFont(font);
    available_version.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    available_version.setForeground(green_color);
   
    label = new Label(window_content,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("updaterwindow.label.last_update") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    last_update = new Label(window_content,SWT.NONE);
    last_update.setFont(skin.getDefaultFont());
    last_update.setForeground(skin.getDefaultColor());
    last_update.setForeground(skin.getDefaultColor());
    last_update.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

   
    download_link = new CLabel(shell,SWT.NONE);
    grid_data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    grid_data.horizontalSpan = 2;
    download_link.setLayoutData(grid_data);
    download_link.setText(_._("updaterwindow.label.download_link"));
    download_link.setData(JMConstants.JMULE_DOWNLOAD_PAGE);
    download_link.setForeground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    download_link.setCursor(new Cursor(SWTThread.getDisplay(),SWT.CURSOR_HAND));
    download_link.addMouseListener(new MouseAdapter() { 
      public void mouseDoubleClick(MouseEvent arg0) {
        String path = (String) ((CLabel) arg0.widget).getData();
        if (!Utils.launchProgram(path))
          Utils.showWarningMessage(shell, _._("updaterwindow.error_open_url.title")
              , Localizer._("updaterwindow.error_open_url",path));
      }
      public void mouseDown(MouseEvent arg0) {
        String path = (String) ((CLabel) arg0.widget).getData();
        if (!Utils.launchProgram(path))
          Utils.showWarningMessage(shell, _._("updaterwindow.error_open_url.title")
              , Localizer._("updaterwindow.error_open_url",path));
      }
    });
   
    download_link.setVisible(false);
   
    Group changelog_group = new Group(shell,SWT.NONE);
    changelog_group.setLayout(new FillLayout());
    changelog_group.setLayoutData(new GridData(GridData.FILL_BOTH));
    changelog_group.setText(_._("updaterwindow.group.changelog"));
   
    changelog_text = new StyledText(changelog_group,SWT.H_SCROLL | SWT.V_SCROLL);
    changelog_text.setEditable(false);
    Font font_changelog = new Font(SWTThread.getDisplay(),"Courier",10,SWT.NONE );
    changelog_text.setFont(font_changelog);
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    layout = new GridLayout(3,false);
    button_bar.setLayout(layout);
   
    final Button button_startup_check = new Button(button_bar,SWT.CHECK);
    grid_data = new GridData();
    grid_data.horizontalSpan = 2;
    grid_data.horizontalAlignment = GridData.BEGINNING;
    button_startup_check.setLayoutData(grid_data);
    button_startup_check.setText(_._("updaterwindow.check.startup_check"));
    button_startup_check.setSelection(SWTPreferences.getInstance().updateCheckAtStartup());
   
    Button button_ok = new Button(button_bar,SWT.NONE);
    button_ok.setFont(skin.getButtonFont());
    button_ok.setText(_._("updaterwindow.button.ok"));
    button_ok.setImage(SWTImageRepository.getImage("ok.png"));
    grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
View Full Code Here

TOP

Related Classes of org.jmule.ui.swt.skin.SWTSkin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.