com.google.gwt.user.client.ui.Widget Java Examples

The following examples show how to use com.google.gwt.user.client.ui.Widget. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteSocketForm.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public Widget asWidget() {

        buildForm();
        form.setEnabled(false);

        FormHelpPanel helpPanel = new FormHelpPanel(
                new FormHelpPanel.AddressCallback() {
                    @Override
                    public ModelNode getAddress() {
                        ModelNode address = new ModelNode();
                        address.add("socket-binding-group", "*");
                        address.add("remote-destination-outbound-socket-binding", "*");
                        return address;
                    }
                }, form);

        FormToolStrip<RemoteSocketBinding> formTools = new FormToolStrip<>(form, callback);
        FormLayout formLayout = new FormLayout().setForm(form).setHelp(helpPanel);
        formLayout.setTools(formTools);
        return formLayout.build();
    }
 
Example #2
Source File: TaskExecutionsTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected Widget getCell(final TaskExecutionInterface e, final TaskExecutionsTableColumn column, final int idx) {
	switch (column) {
	case DATE: return new Label(sDateFormatMeeting.format(e.getExecutionDate()));
	case TIME: return new Label(e.getExecutionTime(CONSTANTS));
	case QUEUED: return new Label(e.getQueued() == null ? "" : sDateFormatTS.format(e.getQueued()));
	case STARTED: return new Label(e.getStarted() == null ? "" : sDateFormatTS.format(e.getStarted()));
	case FINISHED: return new Label(e.getFinished() == null ? "" : sDateFormatTS.format(e.getFinished()));
	case STATUS: return new Label(CONSTANTS.taskStatus()[e.getStatus().ordinal()]);
	case MESSAGE:
		Label message = new Label(e.getStatusMessage() == null ? "" : e.getStatusMessage()); message.addStyleName("status-message");
		if (e.getStatusMessage() != null)
			message.setTitle(e.getStatusMessage());
		return message;
	case OUTPUT:
		if (e.getOutput() != null) return new Anchor(e.getOutput(), GWT.getHostPageBaseURL() + "taskfile?e=" + e.getId());
		return new Label("");
	default:
		return null;
	}
}
 
Example #3
Source File: UploadStep.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    final FlowPanel panel = new FlowPanel();

    HTML description = new HTML(Console.CONSTANTS.common_label_chooseFile());
    description.getElement().setAttribute("style", "padding-bottom:15px;");
    panel.add(description);

    form = new FormPanel();

    // create a panel to hold all of the form widgets.
    VerticalPanel formPanel = new VerticalPanel();
    form.setWidget(formPanel);

    // create a FileUpload widgets.
    fileUpload = new FileUpload();
    fileUpload.setName("uploadFormElement");
    IdHelper.setId(fileUpload, id(), "file");
    formPanel.add(fileUpload);

    panel.add(form);
    return panel;
}
 
Example #4
Source File: GitHubExportDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private Widget createCommitPanel() {
	final VerticalPanel panel = new VerticalPanel();
	panel.setWidth("350px");		
	panel.setSpacing(10);				
	
	fileNameField = new TextField();
	fileNameField.setTitle(UIMessages.INSTANCE.gitHubFileNameField());
	fileNameField.setEmptyText(UIMessages.INSTANCE.gitHubFileNameField());
	fileNameField.setWidth(FIELD_WIDTH);
	panel.add(fileNameField);
			
	messageField = new TextField();
	messageField.setTitle(UIMessages.INSTANCE.gitHubMessageCommitField());
	messageField.setEmptyText(UIMessages.INSTANCE.gitHubMessageCommitField());
	messageField.setWidth(FIELD_WIDTH);
	panel.add(messageField);

	return panel;
}
 
Example #5
Source File: CubaGroupTableWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
public CubaGroupTableBody.CubaGroupTableGroupRow getRenderedGroupRowByKey(String key) {
    if (scrollBody != null) {
        Iterator<Widget> it = scrollBody.iterator();
        CubaGroupTableBody.CubaGroupTableGroupRow row;
        while (it.hasNext()) {
            Widget widget = it.next();
            if (widget instanceof CubaGroupTableBody.CubaGroupTableGroupRow) {
                row = (CubaGroupTableBody.CubaGroupTableGroupRow) widget;
                if (row.getGroupKey().equals(key)) {
                    return row;
                }
            }
        }
    }
    return null;
}
 
Example #6
Source File: GwtUIUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
@SuppressWarnings("unchecked")
public static <T extends Widget> T getParentOf(Widget widget, Class<T> type) {
  Widget target = widget;

  do {
    if (target.getClass() == type) {
      return (T)target;
    }

    target = target.getParent();
  }
  while (target != null);

  return null;
}
 
Example #7
Source File: DragSourceSupport.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private void onDragStart(Widget sender, int x, int y) {
  // Notify drag source of the drag starting
  dragSource.onDragStart();

  // Cache the set of permissible drop targets
  dropTargets = dragSource.getDropTargets();

  // Show drag proxy widget
  dragWidgetPopup = new DragWidgetPopup(dragSource.createDragWidget(startX, startY));
  dragWidgetPopup.setPopupPosition(
      /*absX*/ x + sender.getAbsoluteLeft(),
      /*absY*/ y + sender.getAbsoluteTop());
  dragWidgetPopup.show();

  // Initialize hover state
  hoverDropTarget = null;
}
 
Example #8
Source File: DomainRuntimePresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewConfigDialoge() {

        // TODO: server group store (circuit)
        serverGroupDAO.loadServerGroups(new SimpleCallback<List<ServerGroupRecord>>() {
            @Override
            public void onSuccess(List<ServerGroupRecord> serverGroups) {
                window = new DefaultWindow(Console.MESSAGES.createTitle("New Server Configuration"));
                window.setWidth(640);
                window.setHeight(480);

                NewServerConfigWizard wizard = new NewServerConfigWizard(DomainRuntimePresenter.this);
                Widget w = wizard.asWidget();


                wizard.updateGroups(serverGroups);
                wizard.updateHosts(hostStore.getHostNames());
                window.trapWidget(w);

                window.setGlassEnabled(true);
                window.center();
            }
        });

    }
 
Example #9
Source File: VerifyUploadStep.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    FlowPanel panel = new FlowPanel();
    panel.add(new StaticHelpPanel(StaticHelp.replace()).asWidget());

    form = new Form<>(UploadBean.class);
    TextBoxItem nameField = new TextBoxItem("name", Console.CONSTANTS.common_label_name());
    TextBoxItem runtimeNameField = new TextBoxItem("runtimeName", Console.CONSTANTS.common_label_runtimeName());
    enable = new CheckBoxItem("enableAfterDeployment", Console.CONSTANTS.common_label_enable());
    if (wizard instanceof CanEnableDeployment) {
        form.setFields(nameField, runtimeNameField, enable);
    } else {
        form.setFields(nameField, runtimeNameField);
    }
    panel.add(form.asWidget());

    return panel;
}
 
Example #10
Source File: GeoDataImportDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private SelectionHandler<Widget> getTabPanelSelectionHandler() {
	return new SelectionHandler<Widget>() {

		@Override
		public void onSelection(SelectionEvent<Widget> event) {
			if (UIMessages.INSTANCE.empty().equals(getActiveTab())) {
				dataFormatField.setVisible(false);
			} else {
				dataFormatField.setVisible(true);
			}
			if (UIMessages.INSTANCE.wfs().equals(getActiveTab())) {
				vectorFormatCombo.setValue(VectorFormat.GML_FORMAT);
			} else {
				vectorFormatCombo.setValue(null);
			}
			
			if (UIMessages.INSTANCE.gitHubResponseTitle().equals(getActiveTab())) {					
				layerName.setEnabled(false);
			} else {
				layerName.setEnabled(true);
			}
		}
	};
}
 
Example #11
Source File: CustomExtentDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private Widget createPanel() {
	
	VerticalLayoutContainer container = new VerticalLayoutContainer();
	container.setScrollMode(ScrollMode.AUTO);
	container.setSize("450px", "160px");
			
	Label bboxLabel = new Label("Bbox (" + UIMessages.INSTANCE.lowerLeftXField() + ", " + UIMessages.INSTANCE.lowerLeftYField() + 
			", " + UIMessages.INSTANCE.upperRightXField() + ", " + UIMessages.INSTANCE.upperRightYField() + ")");
	bboxLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);		
	container.add(bboxLabel);
	bboxField = new TextField();
	bboxField.setEmptyText(UIMessages.INSTANCE.bboxFieldCustomExtent());		
	bboxField.setWidth("450px");
	container.add(bboxField);	
	return container;
}
 
Example #12
Source File: ConnectorServiceForm.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    buildForm();

    if (isCreate) {
        form.setNumColumns(1);
    } else {

        form.setNumColumns(2);
        form.setEnabled(false);
    }

    FormHelpPanel helpPanel = new FormHelpPanel(() -> {
        ModelNode address = Baseadress.get();
        address.add("subsystem", "messaging-activemq");
        address.add("server", presenter.getCurrentServer());
        address.add("connector-service", "*");
        return address;
    }, form);

    FormLayout formLayout = new FormLayout()
            .setForm(form)
            .setHelp(helpPanel);

    if (!isCreate) {
        FormToolStrip<ActivemqConnectorService> formTools = new FormToolStrip<>(form, callback);
        formLayout.setTools(formTools);
    }

    return formLayout.build();
}
 
Example #13
Source File: SimpleForm.java    From unitime with Apache License 2.0 5 votes vote down vote up
public int addHeaderRow(Widget widget) {
	int row = getRowCount();
	getFlexCellFormatter().setColSpan(row, 0, iColSpan);
	getFlexCellFormatter().setStyleName(row, 0, "unitime-MainTableHeader");
	getRowFormatter().setStyleName(row, "unitime-MainTableHeaderRow");
	setWidget(row, 0, widget);
	return row;
}
 
Example #14
Source File: EEGlobalAttributesView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {

        ResourceDescription definition = presenter.getDescriptionRegistry().lookup(RESOURCE_ADDRESS);
        SecurityContext securityContext = Console.MODULES.getSecurityFramework().getSecurityContext(presenter.getProxy().getNameToken());

        final ModelNodeFormBuilder.FormAssets formAssets = new ModelNodeFormBuilder()
                .setConfigOnly()
                .include(
                        "annotation-property-replacement",
                        "ear-subdeployments-isolated",
                        "jboss-descriptor-property-replacement",
                        "spec-descriptor-property-replacement"
                )
                .setResourceDescription(definition)
                .setSecurityContext(securityContext).build();

        form = formAssets.getForm();
        form.setToolsCallback(new FormCallback() {
            @Override
            public void onSave(Map changeset) {
                presenter.onSaveResource(RESOURCE_ADDRESS, null, changeset);
            }

            @Override
            public void onCancel(Object entity) {
                form.cancel();
            }
        });

        VerticalPanel formPanel = new VerticalPanel();
        formPanel.setStyleName("fill-layout-width");
        formPanel.add(formAssets.getHelp().asWidget());
        formPanel.add(form.asWidget());

        // ----
        return formPanel;
    }
 
Example #15
Source File: LayerInfoDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createPanel() {

		VerticalPanel vPanel = new VerticalPanel();
		vPanel.setPixelSize(490, 400);
		vPanel.setSpacing(5);
		vPanel.add(createTopPanel());
		vPanel.add(createBottomPanel());
				
		return vPanel;
	}
 
Example #16
Source File: MsgConnectionsView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {

    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Messaging Connections");
    layout.add(titleBar);

    panel = new PagedView(true);

    acceptorOverview = new AcceptorOverview(presenter);
    connectorOverview = new ConnectorOverview(presenter);
    connectorServiceList = new ConnectorServiceList(presenter);
    bridgesList = new BridgesList(presenter);

    panel.addPage("Acceptor", acceptorOverview.asWidget()) ;
    panel.addPage("Connector", connectorOverview.asWidget()) ;
    panel.addPage("Connector Services", connectorServiceList.asWidget()) ;
    panel.addPage("Bridges", bridgesList.asWidget()) ;

    // default page
    panel.showPage(0);


    Widget panelWidget = panel.asWidget();
    layout.add(panelWidget);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
    layout.setWidgetTopHeight(panelWidget, 40, Style.Unit.PX, 100, Style.Unit.PCT);

    return layout;
}
 
Example #17
Source File: RecycleManager.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to insert the provided widgets with {@link RecycleType} defined
 */
protected void insert(List<Widget> widgets) {
    switch (type) {
        case DETACH:
            for (Widget widget : widgets) {
                int index = widgets.indexOf(widget);
                parent.insert(widget, index);
            }

            break;
        case DISPLAY:
            widgets.forEach(widget -> widget.getElement().getStyle().setDisplay(Style.Display.BLOCK));
            break;
    }
}
 
Example #18
Source File: EditorHarness.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean onKeySignal(final Widget sender, SignalEvent event) {
  // Deferred command so we have a look at the content after it's updated
  ScheduleCommand.addCommand(new Task() {
    public void execute() {
       if (sender == editor1) {
         outputEditorState(editor1, prettyContent1, prettyHtml1);
       } else {
         outputEditorState(editor2, prettyContent2, prettyHtml2);
       }
    }
  });
  return false;
}
 
Example #19
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget createNowLink(final TextBox textbox) {
  return new CommandLink("Now", new Command() {
    //@Override
    public void execute() {
      textbox.setText(FORMAT.format(new Date()));
    }
  });
}
 
Example #20
Source File: Wizard.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {
    assertSteps();
    state = initialState();

    VerticalPanel root = new VerticalPanel();
    root.setStyleName("window-content");

    header = new HTML();
    errorMessages = new HTML();
    errorMessages.setVisible(false);
    errorMessages.setStyleName("error-panel");
    body = new StateDeckPanel();
    footer = new Footer();

    int index = 0;
    for (Map.Entry<S, WizardStep<C, S>> entry : steps.entrySet()) {
        stateIndex.put(entry.getKey(), index);
        body.add(entry.getValue().asWidget(context));
        index++;
    }

    root.add(header);
    root.add(errorMessages);
    root.add(body);
    pushState(state);

    return new TrappedFocusPanel(new WindowContentBuilder(root, footer.asWidget()).build());
}
 
Example #21
Source File: Tools.java    From cuba with Apache License 2.0 5 votes vote down vote up
public static boolean isSuitableWidget(Widget slotWidget) {
    if (slotWidget instanceof VButton) {
        VButton button = (VButton) slotWidget;

        if (button.isEnabled()) {
            return true;
        }
    } else if (slotWidget instanceof CubaFileUploadWidget) {
        return true;
    } else if (slotWidget instanceof VUpload) {
        return true;
    }

    return false;
}
 
Example #22
Source File: ImageThumbnailWidget.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Create a double buffer loader for a given image widget
 *
 * @param spinner
 * @param imageToLoad
 */
public DoubleBufferImage(Widget spinner, Widget error, Image imageToLoad) {
  if (UserAgent.isIE()) {
    DomHelper.makeUnselectable(doubleLoadedImage.getElement());
  }
  this.spinner = spinner;
  this.error = error;
  this.imageToLoad = imageToLoad;
}
 
Example #23
Source File: CoordinateGeolocationDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private Widget createPanel() {
	final VerticalLayoutContainer panel = new VerticalLayoutContainer();
	
	longitudTextField = new TextField();
	longitudTextField.setTitle(UIMessages.INSTANCE.longitude());
	longitudTextField.setAllowBlank(false);

	longitudTextField.setWidth(FIELD_WIDTH);

	final FieldLabel longitudLabel = new FieldLabel(longitudTextField,
			UIMessages.INSTANCE.longitude());
	panel.add(longitudLabel, new VerticalLayoutData(1, -1));
	
	latitudTextField = new TextField();
	latitudTextField.setTitle(UIMessages.INSTANCE.latitude());
	latitudTextField.setWidth(FIELD_WIDTH);
	latitudTextField.setAllowBlank(false);

	final FieldLabel latitudLabel = new FieldLabel(latitudTextField,
			UIMessages.INSTANCE.latitude());
	panel.add(latitudLabel, new VerticalLayoutData(1, -1));

	initializeFields();

	epsgCombo = new ProjectionComboBox(FIELD_WIDTH);
	epsgCombo.setValue("WGS84");
	final FieldLabel epsgLabel = new FieldLabel(epsgCombo,
			UIMessages.INSTANCE.lidProjectionLabel());
	panel.add(epsgLabel, new VerticalLayoutData(1, -1));
	return panel;
}
 
Example #24
Source File: ChooseStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    FlowPanel body = new FlowPanel();

    deployNew = new RadioButton("deployment_kind", Console.CONSTANTS.uploadNewDeployment());
    deployNew.addStyleName("radio-block");
    IdHelper.setId(deployNew, id(), "deployNew");
    addDescription(deployNew, Console.CONSTANTS.uploadNewDeploymentDescription());

    deployExisting = new RadioButton("deployment_kind", Console.CONSTANTS.chooseFromContentRepository());
    deployExisting.addStyleName("radio-block");
    IdHelper.setId(deployExisting, id(), "deployExisting");
    addDescription(deployExisting,Console.CONSTANTS.chooseFromContentRepositoryDescription());

    deployUnmanaged = new RadioButton("deployment_kind", Console.CONSTANTS.createUnmanaged());
    deployUnmanaged.addStyleName("radio-block");
    IdHelper.setId(deployUnmanaged, id(), "deployUnmanaged");
    addDescription(deployUnmanaged, Console.CONSTANTS.createUnmanagedDescription());

    if (showDeployNew) {
        body.add(deployNew);
    }
    if (showDeployExisting) {
        body.add(deployExisting);
    }
    if (showDeployUnmanaged) {
        body.add(deployUnmanaged);
    }
    return body;
}
 
Example #25
Source File: TimeGrid.java    From unitime with Apache License 2.0 5 votes vote down vote up
public Widget getPrintWidget(int width) {
	int firstHour = firstSlot() / 12;
	int lastHour = 1 + lastSlot() / 12;
	TimeGrid tg = new TimeGrid(iColor, iNrDays, width, true, (firstHour < 7 ? firstHour : 7), (lastHour > 18 ? lastHour : 18));
	int i = 0;
	for (ClassAssignmentInterface.ClassAssignment c: iClasses)
		for (Meeting m : tg.addClass(c, i++)) {
			m.hidePin();
			m.setDummy();
			m.addStyleName("meeting-selected-noshadow");
		}
	for (BusyPanel busy: iBusy)
		tg.addBusy(busy.getTitle(), busy.getDay(), busy.getStart(), busy.getLength());
	return tg;
}
 
Example #26
Source File: MsgConnectionsView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget createWidget() {

    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Messaging Connections");
    layout.add(titleBar);

    PagedView panel = new PagedView(true);

    acceptorOverview = new AcceptorOverview(presenter);
    connectorOverview = new ConnectorOverview(presenter);
    connectionFactories = new ConnectionFactoryList(presenter);
    connectorServiceList = new ConnectorServiceList(presenter);
    bridgesList = new BridgesList(presenter);
    pooledConnectionFactoryView = new PooledConnectionFactoryView(presenter);

    panel.addPage("Acceptor", acceptorOverview.asWidget());
    panel.addPage("Connector", connectorOverview.asWidget());
    panel.addPage("Connector Services", connectorServiceList.asWidget());
    panel.addPage("Connection Factories", connectionFactories.asWidget());
    panel.addPage("Pooled Connection Factory", pooledConnectionFactoryView.asWidget());
    panel.addPage("Bridges", bridgesList.asWidget());

    // default page
    panel.showPage(0);

    Widget panelWidget = panel.asWidget();
    layout.add(panelWidget);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 40, Style.Unit.PX);
    layout.setWidgetTopHeight(panelWidget, 40, Style.Unit.PX, 100, Style.Unit.PCT);

    return layout;
}
 
Example #27
Source File: MultiViewImpl.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget asWidget() {

    if(null==deck) {
        this.deck = new DeckLayoutPanel();
        createWidget();
    }

    return deck;
}
 
Example #28
Source File: MenuBarView.java    From gwt-material-demo with Apache License 2.0 5 votes vote down vote up
@UiHandler("dpMode")
void onSelectionMode(SelectionEvent<Widget> selection) {
    for(Widget w : dpMode.getItems()){
        if(w instanceof MaterialCheckBox){
            ((MaterialCheckBox) w).setValue(false);
        }
    }
    if(selection.getSelectedItem() instanceof MaterialCheckBox){
        ((MaterialCheckBox) selection.getSelectedItem()).setValue(true);
        MaterialToast.fireToast("Checked : " + ((MaterialCheckBox) selection.getSelectedItem()).getText());
    }
}
 
Example #29
Source File: JberetMetricsView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Widget createWidget() {
    DefaultTabLayoutPanel tabs = new DefaultTabLayoutPanel(40, Style.Unit.PX);
    tabs.addStyleName("default-tabpanel");
    tabs.add(threadPoolPanel.asWidget(), "Batch");
    tabs.add(jobsPanel.asWidget(), "Jobs");
    tabs.selectTab(0);

    return tabs;
}
 
Example #30
Source File: GwtRenderingMutationHandlerGwtTest.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("static")
private void deferredHandler(final Flow flow) {
  handler = new GwtRenderingMutationHandler(flow) {
    @Override
    protected Widget createGwtWidget(Renderable element) {
      return null;
    }
  };

  initDoc();
}