1 /*******************************************************************************
2 * Copyright (c) 2016 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.application
.start
.update
.checker
;
13 import org
.eclipse
.jface
.dialogs
.IDialogConstants
;
14 import org
.eclipse
.jface
.dialogs
.TitleAreaDialog
;
15 import org
.eclipse
.rap
.rwt
.RWT
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.events
.SelectionAdapter
;
18 import org
.eclipse
.swt
.events
.SelectionEvent
;
19 import org
.eclipse
.swt
.graphics
.Point
;
20 import org
.eclipse
.swt
.layout
.GridData
;
21 import org
.eclipse
.swt
.layout
.GridLayout
;
22 import org
.eclipse
.swt
.widgets
.Button
;
23 import org
.eclipse
.swt
.widgets
.Composite
;
24 import org
.eclipse
.swt
.widgets
.Control
;
25 import org
.eclipse
.swt
.widgets
.Label
;
26 import org
.eclipse
.swt
.widgets
.Shell
;
28 import com
.hangum
.tadpole
.application
.start
.Messages
;
29 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
;
30 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.SystemDefine
;
31 import com
.hangum
.tadpole
.commons
.libs
.core
.message
.CommonMessages
;
32 import com
.hangum
.tadpole
.commons
.util
.CookieUtils
;
33 import com
.hangum
.tadpole
.commons
.util
.GlobalImageUtils
;
36 * new version view diloag
41 public class NewVersionViewDialog
extends TitleAreaDialog
{
42 private NewVersionObject newVersionObj
;
43 private Button btnDonotShow
;
49 public NewVersionViewDialog(Shell parentShell
, NewVersionObject newVersionObj
) {
52 this.newVersionObj
= newVersionObj
;
56 public void configureShell(Shell newShell
) {
57 super.configureShell(newShell
);
58 newShell
.setText(SystemDefine
.DBHUB_NAME
);
59 newShell
.setImage(GlobalImageUtils
.getTadpoleIcon());
63 * Create contents of the dialog.
67 protected Control
createDialogArea(Composite parent
) {
68 setMessage(Messages
.get().NewVersionViewDialog_0
); //$NON-NLS-1$
69 setTitle(Messages
.get().NewVersionViewDialog_1
); //$NON-NLS-1$
70 Composite area
= (Composite
) super.createDialogArea(parent
);
71 Composite container
= new Composite(area
, SWT
.NONE
);
72 container
.setLayout(new GridLayout(2, false));
73 container
.setLayoutData(new GridData(GridData
.FILL_BOTH
));
75 Label lblCurrentVersion
= new Label(container
, SWT
.NONE
);
76 lblCurrentVersion
.setText(Messages
.get().NewVersionViewDialog_2
); //$NON-NLS-1$
78 Label lblCurrentversionvalue
= new Label(container
, SWT
.NONE
);
79 lblCurrentversionvalue
.setText(SystemDefine
.getDBHubSystemInfo());
80 new Label(container
, SWT
.NONE
);
82 Label labelRight
= new Label(container
, SWT
.SEPARATOR
| SWT
.HORIZONTAL
);
83 labelRight
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
85 Label lblNewVersion
= new Label(container
, SWT
.NONE
);
86 lblNewVersion
.setText(Messages
.get().NewVersionViewDialog_NewVersion
);
88 Label lblNewversionvalue
= new Label(container
, SWT
.NONE
);
89 lblNewversionvalue
.setText(newVersionObj
.getMajorVer() + " " + newVersionObj
.getSubVer() + " - " + newVersionObj
.getDate());
91 Label lblInformationUrl
= new Label(container
, SWT
.NONE
);
92 lblInformationUrl
.setText(Messages
.get().NewVersionViewDialog_7
); //$NON-NLS-1$
94 Label lblInformationurlvalue
= new Label(container
, SWT
.NONE
);
95 lblInformationurlvalue
.setData( RWT
.MARKUP_ENABLED
, Boolean
.TRUE
);
96 lblInformationurlvalue
.setText(String
.format(Messages
.get().NewVersionViewDialog_8
, newVersionObj
.getInfoUrl())); //$NON-NLS-1$
98 Label lblDownloadUrl
= new Label(container
, SWT
.NONE
);
99 lblDownloadUrl
.setText(Messages
.get().NewVersionViewDialog_5
); //$NON-NLS-1$
101 Label lblDownloadurlvalue
= new Label(container
, SWT
.NONE
);
102 lblDownloadurlvalue
.setData( RWT
.MARKUP_ENABLED
, Boolean
.TRUE
);
103 lblDownloadurlvalue
.setText(String
.format(Messages
.get().NewVersionViewDialog_6
, newVersionObj
.getDownloadUrl())); //$NON-NLS-1$
104 new Label(container
, SWT
.NONE
);
106 btnDonotShow
= new Button(container
, SWT
.CHECK
);
107 btnDonotShow
.addSelectionListener(new SelectionAdapter() {
109 public void widgetSelected(SelectionEvent e
) {
110 CookieUtils
.saveCookie(PublicTadpoleDefine
.TDB_COOKIE_UPDATE_CHECK
, ""+btnDonotShow
.getSelection());
113 btnDonotShow
.setText(Messages
.get().NewVersionViewDialog_DoesnotCheck
);
123 private void initUI() {
124 btnDonotShow
.setSelection(CookieUtils
.isUpdateChecker());
128 * Create contents of the button bar.
132 protected void createButtonsForButtonBar(Composite parent
) {
133 createButton(parent
, IDialogConstants
.OK_ID
, CommonMessages
.get().Close
, true); //$NON-NLS-1$
137 * Return the initial size of the dialog.
140 protected Point
getInitialSize() {
141 return new Point(502, 290);